﻿
namespace NetROS.Tiers.Windows.Forms
{
	/// <summary>
	/// abstract OsobaAdrese typed datagridview
	/// </summary>
	[System.ComponentModel.DesignerCategoryAttribute("code")]
	public abstract class OsobaAdreseDataGridViewBase : System.Windows.Forms.UserControl
	{	
		/// <summary> 
		/// Thrown when the current Entity changed.
		/// </summary>
		public event System.EventHandler<OsobaAdreseDataGridViewEventArgs> CurrentEntityChanged;
		
		#region Fields
				
		/// <summary> 
		/// the current entity.
		/// </summary>
		private Entities.OsobaAdrese _currentOsobaAdrese = null;
		//private Dictionary<string, string> _columnsHeaders = new Dictionary<string, string>();
		
		/// <summary> 
		/// the datagridview instance
		/// </summary>
		protected System.Windows.Forms.DataGridView uxOsobaAdreseDataGridView;
		
		/// <summary> 
		/// the errorprovider
		/// </summary>
		protected System.Windows.Forms.ErrorProvider uxOsobaAdreseErrorProvider;
		
		/// <summary> 
		/// the bindingsource
		/// </summary>
		protected System.Windows.Forms.BindingSource uxOsobaAdreseBindingSource;
		
		
		/// <summary> 
		/// the DGV column associated with the ID property
		/// </summary>
		protected System.Windows.Forms.DataGridViewTextBoxColumn uxIDDataGridViewColumn;
		
		/// <summary> 
		/// the DGV column associated with the Adresa property
		/// </summary>
		protected System.Windows.Forms.DataGridViewTextBoxColumn uxAdresaDataGridViewColumn;
		/// <summary> 
		/// the DGV column associated with the IDMjesto property
		/// </summary>
		protected System.Windows.Forms.DataGridViewComboBoxColumn uxIDMjestoDataGridViewColumn;
		/// <summary> 
		/// the DGV column associated with the IDAdresaTip property
		/// </summary>
		protected System.Windows.Forms.DataGridViewComboBoxColumn uxIDAdresaTipDataGridViewColumn;
		
		/// <summary> 
		/// the DGV column associated with the Napomena property
		/// </summary>
		protected System.Windows.Forms.DataGridViewTextBoxColumn uxNapomenaDataGridViewColumn;
		
		/// <summary> 
		/// the DGV column associated with the DatumOd property
		/// </summary>
		protected System.Windows.Forms.DataGridViewTextBoxColumn uxDatumOdDataGridViewColumn;
		
		/// <summary> 
		/// the DGV column associated with the DatumDo property
		/// </summary>
		protected System.Windows.Forms.DataGridViewTextBoxColumn uxDatumDoDataGridViewColumn;
		/// <summary> 
		/// the DGV column associated with the IDOsoba property
		/// </summary>
		protected System.Windows.Forms.DataGridViewComboBoxColumn uxIDOsobaDataGridViewColumn;
		
		/// <summary> 
		/// the DGV column associated with the DodatakZaPrijevoz property
		/// </summary>
		protected System.Windows.Forms.DataGridViewTextBoxColumn uxDodatakZaPrijevozDataGridViewColumn;
		
		#endregion
					
		#region Combo list
		
				
		private Entities.TList<Entities.AdresaTip> _IDAdresaTipList;
		
		/// <summary> 
		/// The list of selectable AdresaTip
		/// </summary>
		[System.ComponentModel.Category("DropDownList BindingSources")]
		public Entities.TList<Entities.AdresaTip> IDAdresaTipList
		{
			get {return this._IDAdresaTipList;}
			set 
			{
				this._IDAdresaTipList = value;
				this.uxIDAdresaTipDataGridViewColumn.DataSource = null;
				this.uxIDAdresaTipDataGridViewColumn.DataSource = this._IDAdresaTipList;
			}
		}
		
		private bool _allowNewItemInIDAdresaTipList;
		
		/// <summary> 
		/// Indicates if user can add an item in the list of AdresaTip
		/// </summary>
		[System.ComponentModel.Category(".netTiers"), System.ComponentModel.Description("Indicates if end user can add a new item in the combobox. an event will be thrown then.")]
		public bool AllowNewItemInIDAdresaTipList
		{
			get { return _allowNewItemInIDAdresaTipList;}
			set
			{
				this._allowNewItemInIDAdresaTipList = value;
				this.uxIDAdresaTipDataGridViewColumn.DisplayStyle = value ? System.Windows.Forms.DataGridViewComboBoxDisplayStyle.ComboBox : System.Windows.Forms.DataGridViewComboBoxDisplayStyle.DropDownButton;
			}
		}
		
				
		private Entities.TList<Entities.Mjesto> _IDMjestoList;
		
		/// <summary> 
		/// The list of selectable Mjesto
		/// </summary>
		[System.ComponentModel.Category("DropDownList BindingSources")]
		public Entities.TList<Entities.Mjesto> IDMjestoList
		{
			get {return this._IDMjestoList;}
			set 
			{
				this._IDMjestoList = value;
				this.uxIDMjestoDataGridViewColumn.DataSource = null;
				this.uxIDMjestoDataGridViewColumn.DataSource = this._IDMjestoList;
			}
		}
		
		private bool _allowNewItemInIDMjestoList;
		
		/// <summary> 
		/// Indicates if user can add an item in the list of Mjesto
		/// </summary>
		[System.ComponentModel.Category(".netTiers"), System.ComponentModel.Description("Indicates if end user can add a new item in the combobox. an event will be thrown then.")]
		public bool AllowNewItemInIDMjestoList
		{
			get { return _allowNewItemInIDMjestoList;}
			set
			{
				this._allowNewItemInIDMjestoList = value;
				this.uxIDMjestoDataGridViewColumn.DisplayStyle = value ? System.Windows.Forms.DataGridViewComboBoxDisplayStyle.ComboBox : System.Windows.Forms.DataGridViewComboBoxDisplayStyle.DropDownButton;
			}
		}
		
				
		private Entities.TList<Entities.Osoba> _IDOsobaList;
		
		/// <summary> 
		/// The list of selectable Osoba
		/// </summary>
		[System.ComponentModel.Category("DropDownList BindingSources")]
		public Entities.TList<Entities.Osoba> IDOsobaList
		{
			get {return this._IDOsobaList;}
			set 
			{
				this._IDOsobaList = value;
				this.uxIDOsobaDataGridViewColumn.DataSource = null;
				this.uxIDOsobaDataGridViewColumn.DataSource = this._IDOsobaList;
			}
		}
		
		private bool _allowNewItemInIDOsobaList;
		
		/// <summary> 
		/// Indicates if user can add an item in the list of Osoba
		/// </summary>
		[System.ComponentModel.Category(".netTiers"), System.ComponentModel.Description("Indicates if end user can add a new item in the combobox. an event will be thrown then.")]
		public bool AllowNewItemInIDOsobaList
		{
			get { return _allowNewItemInIDOsobaList;}
			set
			{
				this._allowNewItemInIDOsobaList = value;
				this.uxIDOsobaDataGridViewColumn.DisplayStyle = value ? System.Windows.Forms.DataGridViewComboBoxDisplayStyle.ComboBox : System.Windows.Forms.DataGridViewComboBoxDisplayStyle.DropDownButton;
			}
		}
		
		#endregion
		
		#region Main Datasource
		
		private Entities.TList<Entities.OsobaAdrese> _OsobaAdreseList;
				
		/// <summary> 
		/// The list of OsobaAdrese to be displayed in the DGV.
		/// </summary>
		[System.ComponentModel.Category("Data")]
		public Entities.TList<Entities.OsobaAdrese> OsobaAdreseList
		{
			get {return this._OsobaAdreseList;}
			set
			{
				this._OsobaAdreseList = value;
				this.uxOsobaAdreseBindingSource.DataSource = null;
				this.uxOsobaAdreseBindingSource.DataSource = value;
				this.uxOsobaAdreseDataGridView.DataSource = null;
				this.uxOsobaAdreseDataGridView.DataSource = this.uxOsobaAdreseBindingSource;				
				//this.uxOsobaAdreseBindingSource.ListChanged += new System.ComponentModel.ListChangedEventHandler(uxOsobaAdreseBindingSource_ListChanged);
				this.uxOsobaAdreseBindingSource.CurrentItemChanged += new System.EventHandler(OnOsobaAdreseBindingSourceCurrentItemChanged);
			}
		}
		
		private void OnOsobaAdreseBindingSourceCurrentItemChanged(object sender, System.EventArgs e)
		{
			_currentOsobaAdrese = uxOsobaAdreseBindingSource.Current as Entities.OsobaAdrese;
			
			if (_currentOsobaAdrese != null)
			{
				_currentOsobaAdrese.Validate();
			}
			//_OsobaAdrese.Validate();
			OnCurrentEntityChanged();
		}

		//void uxOsobaAdreseBindingSource_ListChanged(object sender, System.ComponentModel.ListChangedEventArgs e)
		//{
			//throw new Exception("The method or operation is not implemented.");
		//}		
		
		#endregion
		
		/// <summary>
		/// Gets the currently selected <c cref="Entities.OsobaAdrese"/> instance.
		/// </summary>
		public Entities.OsobaAdrese SelectedOsobaAdrese
		{
			get {return this._currentOsobaAdrese;}
		}
		
		#region other properties
		
		/// <summary>
		/// Gets or sets a value indicating whether you have provided your own data-management operations for the DataGridView control.
		/// </summary>
		[System.ComponentModel.Category(".netTiers")]
		public bool VirtualMode
		{
			get {return this.uxOsobaAdreseDataGridView.VirtualMode;}
			set
			{
				this.uxOsobaAdreseDataGridView.VirtualMode = value;
			}
		}
		
		/// <summary>
		/// Gets or sets a value indicating whether the option to add rows is displayed to the user.
		/// </summary>
		[System.ComponentModel.Category(".netTiers")]
		public bool AllowUserToAddRows
		{
			get {return this.uxOsobaAdreseDataGridView.AllowUserToAddRows;}
			set {this.uxOsobaAdreseDataGridView.AllowUserToAddRows = value;}
		}
		
		/// <summary>
		/// Gets or sets a value indicating whether the user is allowed to delete rows from the DataGridView.
		/// </summary>
		[System.ComponentModel.Category(".netTiers")]
		public bool AllowUserToDeleteRows
		{
			get {return this.uxOsobaAdreseDataGridView.AllowUserToDeleteRows;}
			set {this.uxOsobaAdreseDataGridView.AllowUserToDeleteRows = value;}
		}
		
		/// <summary>
		/// Gets the <c cref="DataGridView"/> instance.
		/// </summary>
		[System.ComponentModel.Category(".netTiers")]
		public System.Windows.Forms.DataGridView DataGridView
		{
			get {return this.uxOsobaAdreseDataGridView;}
		}
		
		/// <summary>
		/// Gets a collection that contains all the columns in the control.
		/// </summary>
		[System.ComponentModel.Category(".netTiers")]		
		[System.ComponentModel.DesignerSerializationVisibilityAttribute(System.ComponentModel.DesignerSerializationVisibility.Visible)]
		//[System.ComponentModel.EditorAttribute("System.Windows.Forms.Design.DataGridViewColumnCollectionEditor, System.Design", typeof(System.Drawing.Design.UITypeEditor))] 
		public System.Windows.Forms.DataGridViewColumnCollection Columns
		{
			get { return this.uxOsobaAdreseDataGridView.Columns; }
		}
		
		#endregion
		
		/// <summary> 
		/// Required designer variable.
		/// </summary>
		private System.ComponentModel.IContainer components = null;
	
		/// <summary> 
		/// Clean up any resources being used.
		/// </summary>
		/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
		protected override void Dispose(bool disposing)
		{
			if (disposing && (components != null))
			{
				components.Dispose();
			}
			base.Dispose(disposing);
		}
	
		#region Constructor
	
		/// <summary>
		/// Initializes a new instance of the <see cref="OsobaAdreseDataGridViewBase"/> class.
		/// </summary>
		public OsobaAdreseDataGridViewBase()
		{			
			this.components = new System.ComponentModel.Container();			
			
			this.uxOsobaAdreseDataGridView = new System.Windows.Forms.DataGridView();
			this.uxOsobaAdreseBindingSource = new System.Windows.Forms.BindingSource(this.components);
			this.uxOsobaAdreseErrorProvider = new System.Windows.Forms.ErrorProvider(this.components);
			this.uxIDDataGridViewColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
			this.uxAdresaDataGridViewColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
			this.uxIDMjestoDataGridViewColumn = new System.Windows.Forms.DataGridViewComboBoxColumn();
			this.uxIDAdresaTipDataGridViewColumn = new System.Windows.Forms.DataGridViewComboBoxColumn();
			this.uxNapomenaDataGridViewColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
			this.uxDatumOdDataGridViewColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
			this.uxDatumDoDataGridViewColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
			this.uxIDOsobaDataGridViewColumn = new System.Windows.Forms.DataGridViewComboBoxColumn();
			this.uxDodatakZaPrijevozDataGridViewColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
			//this.uxIDAdresaTipBindingSource = new AdresaTipBindingSource(this.components);
			//((System.ComponentModel.ISupportInitialize)(this.uxIDAdresaTipBindingSource)).BeginInit();
			//this.uxIDMjestoBindingSource = new MjestoBindingSource(this.components);
			//((System.ComponentModel.ISupportInitialize)(this.uxIDMjestoBindingSource)).BeginInit();
			//this.uxIDOsobaBindingSource = new OsobaBindingSource(this.components);
			//((System.ComponentModel.ISupportInitialize)(this.uxIDOsobaBindingSource)).BeginInit();
			((System.ComponentModel.ISupportInitialize)(this.uxOsobaAdreseDataGridView)).BeginInit();
			((System.ComponentModel.ISupportInitialize)(this.uxOsobaAdreseBindingSource)).BeginInit();
			((System.ComponentModel.ISupportInitialize)(this.uxOsobaAdreseErrorProvider)).BeginInit();
			this.SuspendLayout();
						
			// 
			// uxOsobaAdreseErrorProvider
			// 
			this.uxOsobaAdreseErrorProvider.ContainerControl = this;
			this.uxOsobaAdreseErrorProvider.DataSource = this.uxOsobaAdreseBindingSource;						
			// 
			// uxOsobaAdreseDataGridView
			// 
			this.uxOsobaAdreseDataGridView.AutoGenerateColumns = false;
			this.uxOsobaAdreseDataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
			this.uxOsobaAdreseDataGridView.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
		this.uxIDDataGridViewColumn,
		this.uxAdresaDataGridViewColumn,
		this.uxIDMjestoDataGridViewColumn,
		this.uxIDAdresaTipDataGridViewColumn,
		this.uxNapomenaDataGridViewColumn,
		this.uxDatumOdDataGridViewColumn,
		this.uxDatumDoDataGridViewColumn,
		this.uxIDOsobaDataGridViewColumn,
		this.uxDodatakZaPrijevozDataGridViewColumn			});
			this.uxOsobaAdreseDataGridView.Dock = System.Windows.Forms.DockStyle.Fill;
			this.uxOsobaAdreseDataGridView.Location = new System.Drawing.Point(0, 0);
			this.uxOsobaAdreseDataGridView.Name = "uxOsobaAdreseDataGridView";
			this.uxOsobaAdreseDataGridView.Size = new System.Drawing.Size(470, 300);
			this.uxOsobaAdreseDataGridView.TabIndex = 0;	
			this.uxOsobaAdreseDataGridView.BackgroundColor = System.Drawing.Color.WhiteSmoke;
			this.uxOsobaAdreseDataGridView.EnableHeadersVisualStyles = false;
			this.uxOsobaAdreseDataGridView.DataError += new System.Windows.Forms.DataGridViewDataErrorEventHandler(this.OnOsobaAdreseDataGridViewDataError);
			this.uxOsobaAdreseDataGridView.CellValueNeeded += new System.Windows.Forms.DataGridViewCellValueEventHandler(this.OnOsobaAdreseDataGridViewCellValueNeeded);
			this.uxOsobaAdreseDataGridView.CellValuePushed += new System.Windows.Forms.DataGridViewCellValueEventHandler(this.OnOsobaAdreseDataGridViewCellValuePushed);
			
			//
			// uxIDDataGridViewColumn
			//
			this.uxIDDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxIDDataGridViewColumn.DataPropertyName = "ID";
			this.uxIDDataGridViewColumn.HeaderText = "ID";
			this.uxIDDataGridViewColumn.Name = "uxIDDataGridViewColumn";
			this.uxIDDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxIDDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxIDDataGridViewColumn.ReadOnly = true;		
			//
			// uxAdresaDataGridViewColumn
			//
			this.uxAdresaDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxAdresaDataGridViewColumn.DataPropertyName = "Adresa";
			this.uxAdresaDataGridViewColumn.HeaderText = "Adresa";
			this.uxAdresaDataGridViewColumn.Name = "uxAdresaDataGridViewColumn";
			this.uxAdresaDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxAdresaDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxAdresaDataGridViewColumn.ReadOnly = false;		
			//
			// uxIDMjestoDataGridViewColumn
			//
			this.uxIDMjestoDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxIDMjestoDataGridViewColumn.DataPropertyName = "IDMjesto";
			this.uxIDMjestoDataGridViewColumn.HeaderText = "IDMjesto";
			this.uxIDMjestoDataGridViewColumn.Name = "uxIDMjestoDataGridViewColumn";
			this.uxIDMjestoDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxIDMjestoDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxIDMjestoDataGridViewColumn.ReadOnly = false;		
			//
			// uxIDAdresaTipDataGridViewColumn
			//
			this.uxIDAdresaTipDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxIDAdresaTipDataGridViewColumn.DataPropertyName = "IDAdresaTip";
			this.uxIDAdresaTipDataGridViewColumn.HeaderText = "IDAdresaTip";
			this.uxIDAdresaTipDataGridViewColumn.Name = "uxIDAdresaTipDataGridViewColumn";
			this.uxIDAdresaTipDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxIDAdresaTipDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxIDAdresaTipDataGridViewColumn.ReadOnly = false;		
			//
			// uxNapomenaDataGridViewColumn
			//
			this.uxNapomenaDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxNapomenaDataGridViewColumn.DataPropertyName = "Napomena";
			this.uxNapomenaDataGridViewColumn.HeaderText = "Napomena";
			this.uxNapomenaDataGridViewColumn.Name = "uxNapomenaDataGridViewColumn";
			this.uxNapomenaDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxNapomenaDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxNapomenaDataGridViewColumn.ReadOnly = false;		
			//
			// uxDatumOdDataGridViewColumn
			//
			this.uxDatumOdDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxDatumOdDataGridViewColumn.DataPropertyName = "DatumOd";
			this.uxDatumOdDataGridViewColumn.HeaderText = "DatumOd";
			this.uxDatumOdDataGridViewColumn.Name = "uxDatumOdDataGridViewColumn";
			this.uxDatumOdDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxDatumOdDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxDatumOdDataGridViewColumn.ReadOnly = false;		
			//
			// uxDatumDoDataGridViewColumn
			//
			this.uxDatumDoDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxDatumDoDataGridViewColumn.DataPropertyName = "DatumDo";
			this.uxDatumDoDataGridViewColumn.HeaderText = "DatumDo";
			this.uxDatumDoDataGridViewColumn.Name = "uxDatumDoDataGridViewColumn";
			this.uxDatumDoDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxDatumDoDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxDatumDoDataGridViewColumn.ReadOnly = false;		
			//
			// uxIDOsobaDataGridViewColumn
			//
			this.uxIDOsobaDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxIDOsobaDataGridViewColumn.DataPropertyName = "IDOsoba";
			this.uxIDOsobaDataGridViewColumn.HeaderText = "IDOsoba";
			this.uxIDOsobaDataGridViewColumn.Name = "uxIDOsobaDataGridViewColumn";
			this.uxIDOsobaDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxIDOsobaDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxIDOsobaDataGridViewColumn.ReadOnly = false;		
			//
			// uxDodatakZaPrijevozDataGridViewColumn
			//
			this.uxDodatakZaPrijevozDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxDodatakZaPrijevozDataGridViewColumn.DataPropertyName = "DodatakZaPrijevoz";
			this.uxDodatakZaPrijevozDataGridViewColumn.HeaderText = "DodatakZaPrijevoz";
			this.uxDodatakZaPrijevozDataGridViewColumn.Name = "uxDodatakZaPrijevozDataGridViewColumn";
			this.uxDodatakZaPrijevozDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxDodatakZaPrijevozDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxDodatakZaPrijevozDataGridViewColumn.ReadOnly = false;		
			//
			// uxIDAdresaTipDataGridViewColumn
			//				
			this.uxIDAdresaTipDataGridViewColumn.DisplayMember = "Naziv";	
			this.uxIDAdresaTipDataGridViewColumn.ValueMember = "ID";	
			this.uxIDAdresaTipDataGridViewColumn.DisplayStyleForCurrentCellOnly = true;
			//uxIDAdresaTipDataGridViewColumn.DataSource = uxIDAdresaTipBindingSource;				
				
			//
			// uxIDMjestoDataGridViewColumn
			//				
			this.uxIDMjestoDataGridViewColumn.DisplayMember = "Naziv";	
			this.uxIDMjestoDataGridViewColumn.ValueMember = "ID";	
			this.uxIDMjestoDataGridViewColumn.DisplayStyleForCurrentCellOnly = true;
			//uxIDMjestoDataGridViewColumn.DataSource = uxIDMjestoBindingSource;				
				
			//
			// uxIDOsobaDataGridViewColumn
			//				
			this.uxIDOsobaDataGridViewColumn.DisplayMember = "Ime";	
			this.uxIDOsobaDataGridViewColumn.ValueMember = "ID";	
			this.uxIDOsobaDataGridViewColumn.DisplayStyleForCurrentCellOnly = true;
			//uxIDOsobaDataGridViewColumn.DataSource = uxIDOsobaBindingSource;				
				
			
			// this
			this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
			this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
			this.Controls.Add(this.uxOsobaAdreseDataGridView);
			this.Name = "OsobaAdreseDataGridView";
			this.Size = new System.Drawing.Size(470, 300);
			//((System.ComponentModel.ISupportInitialize)(this.uxIDAdresaTipBindingSource)).EndInit();
			//((System.ComponentModel.ISupportInitialize)(this.uxIDMjestoBindingSource)).EndInit();
			//((System.ComponentModel.ISupportInitialize)(this.uxIDOsobaBindingSource)).EndInit();
			((System.ComponentModel.ISupportInitialize)(this.uxOsobaAdreseErrorProvider)).EndInit();
			((System.ComponentModel.ISupportInitialize)(this.uxOsobaAdreseDataGridView)).EndInit();
			((System.ComponentModel.ISupportInitialize)(this.uxOsobaAdreseBindingSource)).EndInit();
			this.ResumeLayout(false);
		}
		#endregion
				
		#region events
		
		/// <summary>
		/// Raised the CurrentEntityChanged event.
		/// </summary>
		protected void OnCurrentEntityChanged()
		{
			if (CurrentEntityChanged != null)
			{
				OsobaAdreseDataGridViewEventArgs args = new OsobaAdreseDataGridViewEventArgs();
				args.OsobaAdrese = _currentOsobaAdrese;
				CurrentEntityChanged(this, args); 
			}
		}
		
		#endregion
		
		/// <summary>
		/// Strongly typed event 
		/// </summary>
		public class OsobaAdreseDataGridViewEventArgs : System.EventArgs
		{
			private Entities.OsobaAdrese	_OsobaAdrese;
	
			/// <summary>
			/// the  Entities.OsobaAdrese instance.
			/// </summary>
			public Entities.OsobaAdrese OsobaAdrese
			{
				get { return _OsobaAdrese; }
				set { _OsobaAdrese = value; }
			}	
		}
		
		/// <summary>
		/// Handles the DataError event of the uxOsobaAdreseDataGridView control.
		/// </summary>
		/// <param name="sender">The source of the event.</param>
		/// <param name="e">The <see cref="T:System.Windows.Forms.DataGridViewDataErrorEventArgs"/> instance containing the event data.</param>
		protected void OnOsobaAdreseDataGridViewDataError(object sender, System.Windows.Forms.DataGridViewDataErrorEventArgs e)
		{
			System.Diagnostics.Debug.WriteLine(string.Format( "{0}, {1}", e.ColumnIndex, e.RowIndex));
		}
		
		/// <summary>
		/// Handles the CellValueNeeded event of the uxOsobaAdreseDataGridView control.
		/// </summary>
		/// <param name="sender">The source of the event.</param>
		/// <param name="e">The <see cref="T:System.Windows.Forms.DataGridViewCellValueEventArgs"/> instance containing the event data.</param>
		protected void OnOsobaAdreseDataGridViewCellValueNeeded(object sender, System.Windows.Forms.DataGridViewCellValueEventArgs e)
		{
			switch(uxOsobaAdreseDataGridView.Columns[e.ColumnIndex].Name)
			{
					case "uxIDDataGridViewColumn":
						e.Value = OsobaAdreseList[e.RowIndex].ID;
						break;
					case "uxAdresaDataGridViewColumn":
						e.Value = OsobaAdreseList[e.RowIndex].Adresa;
						break;
					case "uxIDMjestoDataGridViewColumn":
						e.Value = OsobaAdreseList[e.RowIndex].IDMjesto;
						break;
					case "uxIDAdresaTipDataGridViewColumn":
						e.Value = OsobaAdreseList[e.RowIndex].IDAdresaTip;
						break;
					case "uxNapomenaDataGridViewColumn":
						e.Value = OsobaAdreseList[e.RowIndex].Napomena;
						break;
					case "uxDatumOdDataGridViewColumn":
						e.Value = OsobaAdreseList[e.RowIndex].DatumOd;
						break;
					case "uxDatumDoDataGridViewColumn":
						e.Value = OsobaAdreseList[e.RowIndex].DatumDo;
						break;
					case "uxIDOsobaDataGridViewColumn":
						e.Value = OsobaAdreseList[e.RowIndex].IDOsoba;
						break;
					case "uxDodatakZaPrijevozDataGridViewColumn":
						e.Value = OsobaAdreseList[e.RowIndex].DodatakZaPrijevoz;
						break;
				default:
				break;
			}
		}
		
		/// <summary>
		/// Handles the CellValuePushed event of the uxOsobaAdreseDataGridView control.
		/// </summary>
		/// <param name="sender">The source of the event.</param>
		/// <param name="e">The <see cref="T:System.Windows.Forms.DataGridViewCellValueEventArgs"/> instance containing the event data.</param>
		protected void OnOsobaAdreseDataGridViewCellValuePushed(object sender, System.Windows.Forms.DataGridViewCellValueEventArgs e)
		{
			switch(uxOsobaAdreseDataGridView.Columns[e.ColumnIndex].Name)
			{
					case "uxIDDataGridViewColumn":
						OsobaAdreseList[e.RowIndex].ID = (System.Int32)e.Value;
						break;
					case "uxAdresaDataGridViewColumn":
						OsobaAdreseList[e.RowIndex].Adresa = (System.String)e.Value;
						break;
					case "uxIDMjestoDataGridViewColumn":
						OsobaAdreseList[e.RowIndex].IDMjesto = (System.Int32)e.Value;
						break;
					case "uxIDAdresaTipDataGridViewColumn":
						OsobaAdreseList[e.RowIndex].IDAdresaTip = (System.Int32)e.Value;
						break;
					case "uxNapomenaDataGridViewColumn":
						OsobaAdreseList[e.RowIndex].Napomena = (System.String)e.Value;
						break;
					case "uxDatumOdDataGridViewColumn":
						OsobaAdreseList[e.RowIndex].DatumOd = (System.DateTime?)e.Value;
						break;
					case "uxDatumDoDataGridViewColumn":
						OsobaAdreseList[e.RowIndex].DatumDo = (System.DateTime?)e.Value;
						break;
					case "uxIDOsobaDataGridViewColumn":
						OsobaAdreseList[e.RowIndex].IDOsoba = (System.Int32)e.Value;
						break;
					case "uxDodatakZaPrijevozDataGridViewColumn":
						OsobaAdreseList[e.RowIndex].DodatakZaPrijevoz = (System.Decimal)e.Value;
						break;
				default:
				break;
			}
		}
	}
}
